<template>
	<view class="content">
		<textarea v-model="memorandum" placeholder="添加备忘录：" maxlength="100" placeholder-class="colorGray" />
		<view class="textGra">已输入<text class="">{{memorandum.length}}</text>/100</view>
		
		
		<button class="registerButton" type="default" @tap="save">保存</button>
	</view>
</template>

<script>
	import submit from "@/serve/api/submit.js"
		export default {
			data() {
				return {
					memorandum:"",
					memoId:"",
				}
			},
			onLoad(e) {
				console.log(e)
				if(e.hasOwnProperty('memoId')){
					this.memoId = e.memoId
				this.getDetail();
				}
			},
			methods:{
				async getDetail (){
					const res = await submit.memoNoteDetail({memoId:this.memoId})
					if(res){
						this.memorandum = res.data.data.memoContent
					}
				},
				async save(){
					if(!this.memorandum){
						this.tip("请输入备忘录")
						return
					}
					const res = await submit.saveMemoNote({memoContent:this.memorandum,memoId:this.memoId})
					if(res){
						let page = getCurrentPages();
						let prevPage = page[page.length - 2];
						prevPage.$vm.pageNum = 1;
						prevPage.$vm.memorandumList = [];
						prevPage.$vm.getMemorand(2)
						if(!this.memoId){
							
							prevPage.$vm.technologicalProcess[2].num = prevPage.$vm.technologicalProcess[2].num + 1
						}
						uni.navigateBack({})
					}
				}
			}
		}
</script>

<style scoped>
	
	.content{
		padding: 30rpx 40rpx;
	}
	textarea{
		font-size: 24rpx;
		background-color: #FFFFFF;
		width: calc(100% - 60rpx);
		border-radius: 16rpx;
		padding: 30rpx;
		height: 500rpx;
	}
	.colorGray{
		color: #ADB5C5;
	}
	.textGra{
		color: #989BA6;
		text-align: right;
		margin-top: 20rpx;
		font-size: 24rpx;
	}
	.textGra text{
		margin-left: 5rpx;
		font-size: 30rpx;
		font-weight: bold;
	}
	.registerButton {
		height: 104rpx;
		background: #017EFE;
		box-shadow: 0rpx 20rpx 30rpx 0rpx rgba(1, 126, 254, 0.2);
		border-radius: 52rpx;
		line-height: 104rpx;
		margin-top: 101rpx;
		font-size: 36rpx;
		color: #FFFFFF;
	}
	
</style>
